package com.ddwl.shop.dao;

import com.ddwl.common.dao.TkDao;
import com.ddwl.shop.dao.mapper.DistributionConfigMapper;
import com.ddwl.shop.dao.model.DistributionConfig;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hemiaojun
 * @Date 2021/5/6 16:53
 */
@Repository
public class DistributionConfigDao extends TkDao<DistributionConfigMapper, DistributionConfig> {

    @Resource
    private DistributionConfigMapper distributionConfigMapper;

    public void deleteByShopDistributionId(String id) {
        Example example = getExample();
        example.and().andEqualTo("shopDistributionId", id);
        distributionConfigMapper.deleteByExample(example);
    }

    public List<DistributionConfig> selectByShopDistributionId(String id) {
        DistributionConfig dc = new DistributionConfig();
        dc.setShopDistributionId(id);
        return select(dc);
    }
}
